package com.czxy.changgou4.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/** 规格
 * @author 桐叔
 * @email liangtong@itcast.cn
 */
@TableName("tb_specification")
@Data
public class Specification {
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String specName;            //规格名称

    private Integer categoryId;         //分类ID

    // 分类对象
    @TableField(exist = false)
    private Category category;

    // 一个规格 拥有 多个规格选项
    @TableField(exist = false)
    private List<SpecificationOption> options = new ArrayList<>();

    // 当前规格选中的规格选项
    @TableField(exist = false)
    private Integer selectId;
}
/*
CREATE TABLE `tb_specification` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `spec_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '规格名称',
  `category_id` int(10) unsigned NOT NULL COMMENT '分类ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

 */